<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>查看环境监测记录</title>
    <link type="text/css" rel="stylesheet" href="/css/style.css" />
</head>
<body>
<div id="main">
    <div class="query-box">
        <div class="title">查看空气质量检测信息:</div>
<form id="form1">
         按地域检索
        <select name="districtId">
            <option value="0">查询全部</option>
            <c:forEach items="${districtlist}" var="t">
            <option value="${t.id}"
                    <c:if test="${t.id==paUser.items.get(0).districtId}">selected</c:if>
            >${t.name}</option>

            </c:forEach>
            <input type="button" value="搜索">
</form>
     <%--   <form id="form1">
            <span>排序方式:</span>
            <select name="orderStr">
                <option value="saleDate desc"
                    <c:if test="${queryVo.orderStr == 'saleDate desc'}">selected</c:if>
                >销售日期</option>
                <option value="totalPrice desc"
                        <c:if test="${queryVo.orderStr == 'totalPrice desc'}">selected</c:if>
                >单笔总价</option>
            </select>
            <input type="button" value="提交">
        </form>
        <c:if test="${pa.items.size() > 0}">--%>
        <table>
            <tr>
                <td>序号</td>
                <td>区域</td>
                <td>检测时间</td>
                <td>PM10数据</td>
                <td>PM25数据</td>
                <td>监测站</td>
<td>进入详情页</td>
                <td>删除</td>
                <a href="/toadd">添加检测记录</a>
            </tr>



               <c:forEach items="${paUser.items}" var="t" varStatus="line">
                   <tr class="${line.count % 2 == 0 ? 'even':''}">
                   <td>${t.id}</td>
                   <td>${t.district.name}</td>
                   <td>
                   <fmt:formatDate value="${t.monitorTime}" pattern="yyyy-MM-dd"></fmt:formatDate>
                  </td>
                   <td>${t.pm10}</td>
                       <td>${t.pm25}</td>
                       <td>${t.monitoringStation}</td>
                       <td><a href="/tomodify?id=${t.id}">进入详情页</a></td>
                   <td><a href="/remove?id=${t.id}">删除</a></td>
                       </c:forEach>

            </table>

        <div id="control">
            <a>首页</a>
            <a>上一页</a>
            <a>下一页</a>
            <a>尾页</a>
            </div>

            </div>
             <%--   <c:forEach items="${pa.items}" var="t" varStatus="line">
                    <tr class="${line.count % 2 == 0 ? 'even':''}">
                        <td>${t.id}</td>
                        <td>${t.product.productName}</td>
                        <td>${t.price}</td>
                        <td>${t.quantity}</td>
                        <td>${t.totalPrice}</td>
                        <td>
                            <fmt:formatDate value="${t.saleDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>
                        </td>
                        <td>${t.user.realName}</td>
                    </tr>
                </c:forEach>
                <tr>
                    <td colspan="5">
                        <a>首页</a> |
                        <a>上一页</a> |
                        <a>下一页</a> |
                        <a>末页</a>
                        第 ${pa.currPage} 页/共 ${pa.totalPage}页
                        (${pa.count}条记录)
                    </td>
                </tr>
            </table>
        </c:if>

        <c:if test="${pa.items.size() == 0}">
            暂时没有销售记录
        </c:if>
    </div>--%>
</body>
<script src="/js/jquery-1.8.3.js">
</script>
<script src="/js/jump.js"></script>
<script>
    $("#form1 :button").bind("click", function () {
        toJump("/query", $("#form1").serialize());
    })


    var currPage = parseInt("${paUser.currPage}");
    var totalPage = parseInt("${paUser.totalPage}");

    if(currPage>1){
        //首页可行
        $("#control a:eq(0)").attr("href", "javascript:void(0)").bind("click", function () {
            toJump(
                "/query",
                "currPage=1"
            )
        });
        $("#control a:eq(1)").attr("href", "javascript:void(0)").bind("click", function () {
           //上一页可行
            toJump("/query",
                "currPage=${paUser.currPage-1}"
            )
        });
    }
    if(currPage<totalPage){

        $("#control a:eq(2)").attr("href", "javascript:void(0)").bind("click", function () {
            toJump("/query",
                "currPage=${paUser.currPage+1}"
            )
        });
        $("#control a:eq(3)").attr("href", "javascript:void(0)").bind("click", function () {
            toJump("/query",
                "currPage=${paUser.totalPage}"
            )
        });
    }
    // $("a :eq(0)").bind("click",function() {
    //
    // })
    // $("a :eq(1)").bind("click",function() {
    //
    // })
    // $("a :eq(2)").bind("click",function() {
    //
    // })
    // $("a :eq(3)").bind("click",function() {
    //
    // })

    //////////
    <%--var currPage = parseInt("${paUser.currPage}");--%>
    <%--var totalPage = parseInt("${paUser.totalPage}");--%>

    /* 分页 */


</script>

<script>
    if ("${msg}"){
    alert("${msg}");
    }
    <c:remove var="msg" scope="session"></c:remove>
</script>

</html>
